<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

Class Authmodel extends CI_Model{

    function __construct()
    {
        parent::__construct();
    }

	function select_admin_user($username='',$password=''){
		$query = $this->db->get_where('admin_users',array('admin_username'=>$username,'admin_password'=>$password));
		$num = $query->num_rows();
		if ( $num > 0 ){
				$sess = array(
									'username' => $username,
									'password' => $password,
									'authen'   => true
				);
		
		$this->session->set_userdata($sess);
		return TRUE;
		
		}else{
			return FALSE;
		}
	}

	private function get_field($fielname=''){
		$rs =  $this->db->list_fields('$fielname');
		foreach ($rs as $field){
			$rs[] = $field;
			return $rs;
		}
	}
}